struct ListNode* reverseBetween(struct ListNode* head, int left, int right){
    struct ListNode *dummy=malloc(sizeof(struct ListNode));
    dummy->next=head;
    struct ListNode *pre=dummy,*p;
    for(int i=0;i<left-1;i++){
        pre=pre->next;
    }
    p=pre->next;
    for(int n=0;n<right-left;n++){
        struct ListNode *tem=p->next;
        p->next=tem->next;
        tem->next=pre->next;
        pre->next=tem;
    }
    return dummy->next;
}